<template>
  <div class="supplier-product-box">
    <img :src="productDetail.image" alt="">
    <div class="product-name">
      <span class="ovd_s" v-text="productDetail.name"></span>
    </div>
    <div class="product-price" v-text="'￥'+ToMoney(productDetail.price)"></div>
    <div class="product-model">
      <div class="model">
        型号: <span v-text="productDetail.supplierProductStockModel?productDetail.supplierProductStockModel:'常规'"></span>
      </div>
      <div class="add-cart">
          <el-button type="danger" @click="addCart">加入购物车</el-button>

      </div>
    </div>
  </div>
</template>

<script>


export default {
  name: 'SupplierProductBox',
  props:{
    productDetail:Object
  },
  methods:{
    addCart:function () {
      let $this=this
      if (this.$props.productDetail.isMoreModel){
        $this.bus.$emit('ProductChooseModelDialogCallBus','productListItem',$this.productDetail)
      }else{
        $this.$message.success('添加成功')
        window.MyCartTools.addProduct(Object.assign($this.$props.productDetail,{
          nums:1,
          model:'常规'
        }))
      }
    }
  }
}
</script>

<style scoped>

</style>
